import { createRouter, createWebHistory } from 'vue-router'
import AppLayout from '@/layout/AppLayout.vue';


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login',
    },
    {
      path: '/home',
      component: AppLayout,
      children: [
        {
          path: '/dashboard',
          name: 'dashboard',
          component: () => import('../components/dashboard/Dashboard.vue'),
        },
        {
          path: '/profile',
          name: 'Profile',
          component: () => import('../components/profile/Profile.vue'),
        },
        {
          path: '/sysUser',
          name: 'SysUser',
          component: () => import('../components/sysUser/SysUser.vue'),
        },
        {
          path: '/permission',
          name: 'Permission',
          component: () => import('../components/permission/Permission.vue'),
        },
        {
          path: '/client',
          name: 'Client',
          component: () => import('../components/client/Client.vue'),
        },
        {
          path: '/product',
          name: 'Product',
          component: () => import('../components/product/Product.vue'),
        },
        {
          path: '/order',
          name: 'Order',
          component: () => import('../components/order/Order.vue'),
        }
      ]
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/orderDetail',
      name: 'orderDetail',
      component: () => import('../components/orderDetail/OrderDetail.vue')
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('../components/Login.vue')
    },
    {
      path: '/test',
      name: 'Test',
      component: () => import('../views/Test.vue')
    }
  ]
})

export default router
